<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .router-link-active{
      background-color: red;
    }
  </style>
</head>
<body>
  <div id="app">
    
    <router-view></router-view>
    <router-view name="b"></router-view>
    <router-view name="c"></router-view>
  </div>
  <script src="./vue.js"></script>
  <script src="./vue-router.js"></script>
  <script>
    const Home = {
      template: `
        <div>
          <h1>
            首页
          </h1>
        </div>
      `
    }
    const Home2 = {
      template: `
        <div>
          <h1>
            首页2
          </h1>
        </div>
      `
    }
    const Home3 = {
      template: `
        <div>
          <h1>
            首页3
          </h1>
        </div>
      `
    }
  
    // 创建路由对象
    const routes = [
      {
        path: '/home',
        name: '首页',
        components: {
          default: Home,
          b: Home2,
          c: Home3
        }
      }
    ]
    const router = new VueRouter({
      routes
    })
    const vm = new Vue({
      el:'#app',
      router,
      methods: {
        enterNews(){
          this.$router.push({
            path: '/news',
            query: {
              a: 100,
              c: 50
            }
          })
        }
      }
    })
  </script>
</body>
</html>